package xm.manager
{
	import flash.display.DisplayObject;
	import flash.display.Stage;
	
	/**
	 * <br> 클래스 설명 : </br>
	 * @author 김정환
	 */	
	public class StageManager
	{
		
		//-----------------------------------------------------------------------------------
		// singleTon Pattern
		//-----------------------------------------------------------------------------------
		private static var _instance : StageManager;

		/**
		 * @return StageManager
		 */		
		public static function getInstance():StageManager
		{
			if( _instance == null ) _instance = new StageManager( new SingletonEnforce() );
			return _instance;
		}
		
		
		
		//-----------------------------------------------------------------------------------
		// public vars
		//-----------------------------------------------------------------------------------
		
		
		
		
		//-----------------------------------------------------------------------------------
		// protected / internal vars
		//-----------------------------------------------------------------------------------
		
		
		
		
		//-----------------------------------------------------------------------------------
		// private vars
		//-----------------------------------------------------------------------------------
		
		private var _stage : Stage;
		
		
		//-----------------------------------------------------------------------------------
		// public functions
		//-----------------------------------------------------------------------------------
		
		/**
		 * constructor 
		 */	
		public function StageManager( se : SingletonEnforce )
		{
			if( se == null ) throw new Error( "StageManager 는 생성하여 사용할 수 없습니다." );
		}
		
		/**
		 * @param child stage 에 add 되어있는 DisplayObject
		 */		
		public function setStage( child:DisplayObject ):void
		{
			if( child != null )
			{
				_stage = child.stage;
			}
		}
		
		
		
		//-----------------------------------------------------------------------------------
		// setter / getter
		//-----------------------------------------------------------------------------------
		
		/**
		 * @return Stage
		 */		
		public function get stage():Stage
		{
			return _stage;
		}
		
		//-----------------------------------------------------------------------------------
		// protected functions
		//-----------------------------------------------------------------------------------
		
		
		
		//-----------------------------------------------------------------------------------
		// internal functions
		//-----------------------------------------------------------------------------------
		
		
		
		
		//-----------------------------------------------------------------------------------
		// private functions
		//-----------------------------------------------------------------------------------
		
		
		
		//-----------------------------------------------------------------------------------
		// event handler
		//-----------------------------------------------------------------------------------
		
		
		
		
		
		
		
		
		
	}
}



class SingletonEnforce{}